import { createApp } from 'vue'
import App from './App.vue'
import router from './router'
import pinia from './stores'
import SvgIcon from './components/SvgIcon/index.vue'

import ElementPlus from 'element-plus'
import zhCn from 'element-plus/dist/locale/zh-cn.mjs'
import 'element-plus/dist/index.css'
import '@/assets/iconfontFlow/iconfont.css';
// 引入Element Plus暗黑模式样式
import 'element-plus/theme-chalk/dark/css-vars.css'
// 导入全局样式
import './styles/index.scss'

// 导入 SVG 图标
import 'virtual:svg-icons-register'
// 创建应用实例
const app = createApp(App)
// 关闭浏览器调试warn提醒
app.config.warnHandler = () => null

// 全局注册 svg-icon 组件
app.component('svg-icon', SvgIcon)

// 如果您正在使用CDN引入，请删除下面一行。
import * as ElementPlusIconsVue from '@element-plus/icons-vue'
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
  app.component(key, component)
}

// 注册插件
app.use(router)
app.use(pinia)
app.use(ElementPlus, {
  locale: zhCn
})
// 挂载应用
app.mount('#app')
